package cmd

import (
	"github.com/spf13/cobra"
	"os"
	"wtester/config"
	"wtester/pkg/yamltester"
)

/*
*

	@author: weicai
	@since: 2024/3/13
	@desc: 主命令

*
*/
var path string

var rootCmd = &cobra.Command{
	Use:   "wtester",
	Short: "wtester",
	Run: func(cmd *cobra.Command, args []string) {
		err := yamltester.ParseYaml(path)
		if err != nil {
			return
		}
	},
}

func init() {
	rootCmd.Flags().StringVarP(&path, "path", "p", path, "file path")
}

func Execute() {
	if err := rootCmd.Execute(); err != nil {
		config.Logger.Error(err.Error())
		os.Exit(1)
	}
}
